<?php
require_once 'test-00-inc.php';

start('Modifications of elements');

test('Appending MOVES elements:','
    $html->body->append($html->body->p[0])->source(),
    $html->body->source()
');

test('Single element can be duplicated:','
    $html->body->append($html->body->p[1]->duplicate())->source(),
    $html->body->source()
');

test('Duplicate and append elements in one operation:','
    $html->body->p[0]->append(new CxApply($html->body->h1, "duplicate"))->source(),
    $html->body->append(new CxApply("h1", "duplicate"))->items[0]["class"] = "DUP",
    $html->body->source()
');

foreach (nz($html->select('//p')) as $item)
    echo $item->value();

test('Check what we have done:','
    count($test = $html->select("body//p")),
    (string)$test
');

result($html);
